﻿Public Class MessageValidation
    Private Shared toolTip As New ToolTip

    Public Shared Sub MyValidation(objHighlighter As DevComponents.DotNetBar.Validator.Highlighter, MyText As Object, ByVal title As String, ByVal myMessage As String)

        toolTip.IsBalloon = True
        objHighlighter.SetHighlightColor(MyText, DevComponents.DotNetBar.Validator.eHighlightColor.Red)
        toolTip.InitialDelay = 10
        toolTip.ToolTipTitle = title
        toolTip.ToolTipIcon = ToolTipIcon.Error
        toolTip.SetToolTip(MyText, myMessage)
        MyText.SelectAll()
        MyText.Focus()
        Exit Sub
    End Sub
    Public Shared Sub ElseValidation(ByVal objHighlighter As DevComponents.DotNetBar.Validator.Highlighter, ByRef myText As Object)
        objHighlighter.SetHighlightColor(myText, DevComponents.DotNetBar.Validator.eHighlightColor.None)
        toolTip.SetToolTip(myText, "")
    End Sub
#Region "ValidationDatabaseData"
    Public Shared Sub ValidationEmployeeCode(ByRef id As Int16, ByRef obj As Object)

        id = Cmd.ExecuteScalar("SELECT COUNT(*) FROM EMPLOYEE WHERE EMPLOYEE_CODE ='" & obj & "' ")

    End Sub
    Public Shared Sub ValidationEnglishName(ByRef EngName As Int16, ByRef obj As Object)

        EngName = Cmd.ExecuteScalar(" SELECT COUNT(*) FROM EMPLOYEE WHERE ENGLISH_NAME  ='" & obj & "' ")

    End Sub
    Public Shared Sub ValidationKhmerName(ByRef KhName As Int16, ByRef obj As Object)

        KhName = Cmd.ExecuteScalar(" SELECT COUNT(*) FROM EMPLOYEE WHERE KHMER_NAME  = N'" & obj & "' ")

    End Sub
    Public Shared Sub ValidationPhone(ByRef phone As Int16, ByRef obj As Object)

        phone = Cmd.ExecuteScalar(" SELECT COUNT(*) FROM EMPLOYEE WHERE PHONE ='" & obj & "' ")

    End Sub
    Public Shared Sub ValidationEmail(ByRef email As Int16, ByRef obj As Object)

        email = Cmd.ExecuteScalar(" SELECT COUNT(*) FROM EMPLOYEE WHERE EMAIL ='" & obj & "' ")

    End Sub
    Public Shared Sub ValidationIdentification(ByRef iDcard As Int16, ByRef obj As Object)

        iDcard = Cmd.ExecuteScalar(" SELECT COUNT(*) FROM EMPLOYEE WHERE ID_CARD =N'" & obj & "' ")

    End Sub
#End Region

End Class
